﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace LittleBirdAuction.Core
{
    [StructLayout(LayoutKind.Sequential)]
    unsafe public struct UiObject
    {
        public fixed uint n1[10];
        public uint visible;
        public fixed uint n2[3];
        public fixed byte path[0x200];    // 038
        public fixed byte _2[0x228];
        public uint addr1_children; // 460
        public fixed byte _3[0x004];
        public uint addr1_count;    // 468
        public fixed byte _4[0x010];
        public fixed uint n3[4];          // 47c
        public fixed byte _5[0x058];
        public uint anim_state;     // 4e4
        public fixed byte _7[0x020];
        public float x1;             // 508
        public float y1;             // 50c
        public float x2;             // 510
        public float y2;             // 514
        public fixed byte _8[0x5C8];
        public uint addr2_value;    // ae0
        public fixed byte _9[0x00c];
        public uint addr3_child;    // af0
        public fixed byte _10[0x418];
        public fixed uint n5[4];          // f0c
    }

    [StructLayout(LayoutKind.Sequential)]
    unsafe public struct UiIdentifier
    {

        public ulong hash;
        public fixed byte path[0x200];
    };

    [StructLayout(LayoutKind.Sequential)]
    public struct UiLink
    {
        public uint next;
        UiIdentifier id;
        public uint address;
    };

    [StructLayout(LayoutKind.Sequential)]
    unsafe public struct UiTable
    {
        public uint next;
        public ulong hash;
        public fixed byte path[0x200];
        public uint address;
    };

    [StructLayout(LayoutKind.Sequential)]
    unsafe public struct UiObjectChild
    {
        public fixed Byte _1[0x04];
        public uint addr_target2;       // 004
        public uint addr_target3;       // 008
    };

    [StructLayout(LayoutKind.Sequential)]
    unsafe public struct AhListRoot
    {
        public fixed Byte _1[0x10];
        public uint sell_count;         // 010
        public uint auction_count;      // 014
        public uint sell_items;         // 018 -> AhListSell
        public uint auction_items;      // 01C -> AhListAuction
    };

    [StructLayout(LayoutKind.Sequential)]
    unsafe public struct AhListAuction            // 108
    {
        public fixed Byte _1[0x020];
        public fixed Byte d3item[0x008];    // 020
        public fixed Byte _2[0x054];
        public fixed Byte d3gold[0x008];    // 07c
        public fixed Byte _3[0x02C];
        public uint id;                 // 0b0
        public fixed Byte _4[0x00c];
        public uint bid1;               // 0c0
        public fixed Byte _5[0x004];
        public uint buyout;             // 0c8
        public fixed Byte _6[0x004];
        public uint bid2;               // 0d0
        public fixed Byte _7[0x01c];
        public ulong time;               // 0f0
        public fixed Byte _8[0x010];
    };

    [StructLayout(LayoutKind.Sequential)]
    unsafe public struct AhListSell              // 248
    {
        public fixed Byte _1[0x0a0];
        public ulong stime;              // 0a0
        public ulong xtime;              // 0a8
        public fixed Byte _2[0x028];
        public uint buyout;             // 0d8
        public fixed Byte _3[0x004];
        public uint bid1;               // 0e0
        public fixed Byte _4[0x004];
        public uint bid2;               // 0e8
        public fixed Byte _5[0x014];
        public uint id;                 // 100
        public fixed Byte _6[0x144];
    };

    [StructLayout(LayoutKind.Sequential)]
    unsafe public struct AhGlobal1
    {
        public fixed Byte _1[0x05C];
        public uint gold;               // 05C
    };

    [StructLayout(LayoutKind.Sequential)]
    unsafe public struct AhGlobal2
    {
        public fixed Byte _1[0x018];
        public uint sellcount;          // 018
    };
}
